package com.java.action;

import java.util.List;

import com.java.pojo.ComDept;
import com.java.pojo.ComEmp;
import com.java.service.IDeptService;

public class DeptAction {
private IDeptService deptservice;
private List<ComDept> dlist;
private int page;
private int currentPage;
private int totalPages;
private static final int PAGEROW=3;
private int xm;
private List<ComEmp> elist;
private List<ComDept> ddlist;
public String execute(){
	System.out.println("deptact1111111...................");
	int count=deptservice.getDeptNum();
	xm=1;
	totalPages=(count%PAGEROW==0)?(count/PAGEROW):(count/PAGEROW+1);
	if(page<1){	
		page=1;
	}
	System.out.println("deptact1..........");
	if(page>totalPages){
		page=totalPages;
	}
	int start=(page-1)*PAGEROW;
	currentPage=page;
	dlist=deptservice.getDeptListByPage(start,PAGEROW);
	elist=deptservice.getAllEmpInDept();
	ddlist=deptservice.getAllDept();
	return "success";
}
public IDeptService getDeptservice() {
	return deptservice;
}
public void setDeptservice(IDeptService deptservice) {
	this.deptservice = deptservice;
}

public List<ComDept> getDlist() {
	return dlist;
}
public void setDlist(List<ComDept> dlist) {
	this.dlist = dlist;
}
public Integer getPage() {
	return page;
}
public void setPage(Integer page) {
	this.page = page;
}
public Integer getCurrentPage() {
	return currentPage;
}
public void setCurrentPage(Integer currentPage) {
	this.currentPage = currentPage;
}
public Integer getTotalPages() {
	return totalPages;
}
public void setTotalPages(Integer totalPages) {
	this.totalPages = totalPages;
}
public static Integer getPagerow() {
	return PAGEROW;
}
public int getXm() {
	return xm;
}
public void setXm(int xm) {
	this.xm = xm;
}
public List<ComEmp> getElist() {
	return elist;
}
public void setElist(List<ComEmp> elist) {
	this.elist = elist;
}
public List<ComDept> getDdlist() {
	return ddlist;
}
public void setDdlist(List<ComDept> ddlist) {
	this.ddlist = ddlist;
}



}
